/**
 * Waline 评论组件 - 玻璃质感精致版
 */

:root {
  --waline-glass-bg: rgba(255, 255, 255, 0.7);
  --waline-glass-border: rgba(255, 255, 255, 0.28);
  --waline-glass-shadow: rgba(31, 38, 135, 0.12);
  --ctl-h: 20px;
  --ctl-pad-y: 6px;
  --ctl-pad-x: 10px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --ring-w: 2px;
  --elev: 0 8px 28px var(--waline-glass-shadow);
}

.dark {
  --waline-glass-bg: rgba(26, 27, 30, 0.72);
  --waline-glass-border: rgba(255, 255, 255, 0.12);
  --waline-glass-shadow: rgba(0, 0, 0, 0.35);
}

.waline-wrapper {
  margin-top: 3rem;
  padding-top: 4.5rem;
  position: relative;
  width: 100%;
  clear: both;
  
  /* 精致液态玻璃装饰 */
  &::before {
    content: "💬 评论区";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
      height: 52px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      font-weight: 600;
      color: var(--vp-c-text-1);
    
      /* 液态玻璃背景 */
      background:
        linear-gradient(135deg,
          rgba(255, 255, 255, 0.9) 0%,
          rgba(240, 248, 255, 0.85) 25%,
          rgba(230, 242, 255, 0.8) 50%,
          rgba(220, 238, 255, 0.85) 75%,
          rgba(255, 255, 255, 0.9) 100%);
      backdrop-filter: blur(12px) saturate(180%);
      border: 1px solid rgba(255, 255, 255, 0.5);
      border-radius: var(--radius-lg);
      box-shadow:
        0 8px 32px rgba(31, 38, 135, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        inset 0 -1px 0 rgba(0, 0, 0, 0.03);
    }
    
    /* 装饰光晕 */
    &::after {
      content: "";
      position: absolute;
      top: 12px;
      left: 50%;
      transform: translateX(-50%);
      width: 60%;
      height: 28px;
      background: radial-gradient(ellipse at center,
          rgba(var(--vp-c-brand-1-rgb, 66, 133, 244), 0.15) 0%,
          transparent 70%);
      filter: blur(8px);
      pointer-events: none;
      z-index: -1;
    }
    }
    
    .dark .waline-wrapper {
    
      /* 暗黑模式液态玻璃 */
      &::before {
        background:
          linear-gradient(135deg,
            rgba(26, 27, 30, 0.95) 0%,
            rgba(30, 35, 45, 0.9) 25%,
            rgba(35, 40, 50, 0.85) 50%,
            rgba(30, 35, 45, 0.9) 75%,
            rgba(26, 27, 30, 0.95) 100%);
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow:
          0 8px 32px rgba(0, 0, 0, 0.35),
          inset 0 1px 0 rgba(255, 255, 255, 0.08),
          inset 0 -1px 0 rgba(0, 0, 0, 0.15);
      }
    
      &::after {
        background: radial-gradient(ellipse at center,
            rgba(var(--vp-c-brand-1-rgb, 100, 160, 255), 0.2) 0%,
            transparent 70%);
  }
}

/* 重置边框 */
.waline-wrapper,
.waline-wrapper *:not(.wl-panel):not(.wl-card):not(.wl-input):not(.wl-btn):not(img),
#waline,
#waline > div,
#waline .wl-comment,
#waline .wl-list {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
}
/* 基础面板 */
#waline .wl-panel {
  background: var(--waline-glass-bg) !important;
  backdrop-filter: blur(10px);
  border: 1px solid var(--waline-glass-border) !important;
  border-radius: var(--radius-lg) !important;
  padding: 16px !important;
  box-shadow: var(--elev) !important;
}

#waline .wl-header {
  border-bottom: none !important;
  margin-bottom: 8px !important;
  padding-bottom: 0 !important;
  
  &-item {
    margin: 8px 0 !important;
    &::after { display: none !important; }
  }
}

/* 表单元素 */
#waline label {
  display: inline-block !important;
  margin-bottom: 4px !important;
  color: var(--vp-c-text-2) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
}

#waline .wl-input {
  background: var(--vp-c-bg) !important;
  border: 1px solid var(--vp-c-divider) !important;
  border-radius: var(--radius-sm) !important;
  padding: var(--ctl-pad-y) var(--ctl-pad-x) !important;
  height: var(--ctl-h) !important;
  font-size: 13px !important;
  color: var(--vp-c-text-1) !important;
  transition: all .2s ease !important;
  
  &::placeholder {
    color: var(--vp-c-text-3) !important;
    font-size: 12px !important;
  }
  
  &:focus-visible {
    outline: none !important;
    border-color: var(--vp-c-brand-1) !important;
    box-shadow: 0 0 0 var(--ring-w) color-mix(in srgb, var(--vp-c-brand-1) 18%, transparent) !important;
    transform: translateY(-1px);
  }
}

#waline .wl-editor {
  background: var(--vp-c-bg-soft) !important;
  border: 1px solid var(--vp-c-divider) !important;
  border-radius: var(--radius-md) !important;
  padding: 10px !important;
  margin-top: 10px !important;
  transition: all .2s ease !important;
  
  &:focus-within {
    border-color: var(--vp-c-brand-1) !important;
    box-shadow: 0 0 0 var(--ring-w) color-mix(in srgb, var(--vp-c-brand-1) 18%, transparent) !important;
  }
  
  textarea {
    color: var(--vp-c-text-1) !important;
    font-size: 13px !important;
    line-height: 1.55 !important;
    min-height: 72px !important;
    max-height: 260px !important;
    resize: vertical !important;
    
    &::placeholder {
      color: var(--vp-c-text-3) !important;
    }
  }
}

/* 按钮与动作区 */
#waline .wl-actions {
  margin-top: 10px !important;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* 统一工具栏图标大小 */
#waline .wl-action {
  width: 32px !important;
  height: 32px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: var(--radius-sm) !important;
  transition: all .2s ease !important;
  cursor: pointer !important;

  svg {
    width: 18px !important;
    height: 18px !important;
    fill: var(--vp-c-text-2) !important;
    transition: all .2s ease !important;
  }

  &:hover {
    background: var(--vp-c-bg-soft) !important;

    svg {
      fill: var(--vp-c-brand-1) !important;
      transform: scale(1.1);
    }
  }
}

/* 提交按钮 - 品牌色 */
#waline .wl-btn {
  background: linear-gradient(135deg, var(--vp-c-brand-1), var(--vp-c-brand-2)) !important;
  color: #fff !important;
  border: 1px solid color-mix(in srgb, var(--vp-c-brand-2) 40%, transparent) !important;
  border-radius: var(--radius-sm) !important;
  padding: 4px 12px !important;
  height: var(--ctl-h) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--vp-c-brand-1) 30%, transparent) !important;
  transition: all .2s ease !important;
  
  &:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--vp-c-brand-1) 38%, transparent) !important;
  }
  
  &:active:not(:disabled) {
    transform: translateY(0);
  }
  
  &:disabled {
    opacity: .55 !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
  }
}

#waline .wl-submit { min-width: 76px !important; }

/* 登录信息 - 精致垂直布局 */
#waline .wl-login-info {
  background: linear-gradient(135deg, var(--vp-c-brand-soft), var(--vp-c-brand-softer)) !important;
  border: none !important;
  border-radius: var(--radius-md) !important;
  padding: 12px 14px !important;
  margin-bottom: 12px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 8px !important;
}

/* 用户名 - 居中显示 */
#waline .wl-login-nick {
  color: var(--vp-c-brand-1) !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  text-align: center !important;
  width: 100% !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* 登录按钮 - 使用灰色调区分 */
#waline .wl-login-info button,
#waline .wl-logout-btn {
  background: var(--vp-c-bg-soft) !important;
    border: 1px solid var(--vp-c-divider) !important;
  border-radius: var(--radius-sm) !important;
  padding: 4px 16px !important;
  font-size: 12px !important;
  height: 26px !important;
  line-height: 1 !important;
  color: var(--vp-c-text-2) !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
}

#waline .wl-login-info button:hover,
#waline .wl-logout-btn:hover {
  background: var(--vp-c-brand-soft) !important;
    border-color: var(--vp-c-brand-1) !important;
    color: var(--vp-c-brand-1) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--vp-c-brand-1) 15%, transparent) !important;
}

#waline .wl-login-info button:active,
#waline .wl-logout-btn:active {
  transform: translateY(0) !important;
}

/* 移动端优化 */
@media (max-width: 640px) {
  #waline .wl-login-info {
    padding: 10px 12px !important;
  }
  
  #waline .wl-login-nick {
    font-size: 13px !important;
  }
  
  #waline .wl-login-info button {
    padding: 3px 12px !important;
    font-size: 11px !important;
    height: 24px !important;
  }
}

/* 评论卡片 */
#waline .wl-card {
  background: var(--waline-glass-bg) !important;
  backdrop-filter: blur(10px);
  border: 1px solid var(--waline-glass-border) !important;
  border-radius: var(--radius-md) !important;
  padding: 12px !important;
  margin-bottom: 10px !important;
  transition: all .2s ease;
  
  &:hover {
    transform: translateX(3px);
    box-shadow: -3px 0 0 0 var(--vp-c-brand-1), 0 4px 14px var(--waline-glass-shadow) !important;
  }
}

#waline .wl-nick {
  color: var(--vp-c-brand-1) !important;
  font-weight: 600 !important;
  font-size: 13.5px !important;
}

#waline .wl-content {
  color: var(--vp-c-text-1) !important;
  line-height: 1.65 !important;
  font-size: 13.5px !important;
  margin-top: 6px !important;
  
  code {
    background: var(--vp-c-bg-mute) !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
  }
  
  pre {
    background: var(--vp-c-bg-mute) !important;
    padding: 10px !important;
    border-radius: 8px !important;
  }
}

#waline .wl-avatar {
  width: 32px !important;
  height: 32px !important;
  
  img {
    border-radius: 50% !important;
    border: 1px solid var(--vp-c-divider) !important;
    transition: all .2s ease !important;
    
    &:hover {
      transform: scale(1.06) !important;
      border-color: var(--vp-c-brand-1) !important;
    }
  }
}

#waline .wl-time {
  color: var(--vp-c-text-3) !important;
  font-size: 12px !important;
}

/* 系统信息标签 */
#waline .wl-comment-meta span,
#waline .wl-meta span {
  background: var(--vp-c-bg-mute) !important;
  color: var(--vp-c-text-2) !important;
  border: 1px solid var(--vp-c-divider) !important;
  padding: 2px 8px !important;
  border-radius: 4px !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  margin-right: 6px !important;
}

/* 响应式 */
@media (max-width: 768px) {
  :root { --ctl-h: 28px; }
  #waline .wl-panel { padding: 14px !important; }
  #waline .wl-editor textarea { min-height: 60px !important; }
}

@media (prefers-reduced-motion: reduce) {
  #waline * {
    transition: none !important;
    animation: none !important;
  }
}